package br.ucb.sigplan.action.impl;

import java.io.IOException;
import java.util.Locale;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.jsp.jstl.core.Config;

import br.ucb.sigplan.action.Action;

public class AbrirCadastroCalendarioAction implements Action {

	@Override
	public String execute(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		Locale locale = (Locale) Config.get(req.getSession(), Config.FMT_LOCALE);
		Locale localeResp = req.getLocale();
		
		System.out.println("Locale Resposta "+localeResp.getLanguage());
		
		if (locale != null)
			System.out.println("Lingua "+locale.getLanguage());
		
		if (Config.get(req.getSession(), Config.FMT_LOCALE) != null &&
				locale.getLanguage().equalsIgnoreCase("pt")){
			req.setAttribute("lingua", 1);
		}
		return "/jsp/diretor/calendario/dirCadastraCalendario.jsp";
	}

}
